package analyzer

import (
	"net"
	"time"
)

// FeatureType 特征类型
type FeatureType int

type Feature interface {
	GetType() FeatureType
	GetScore() float64
}

// 报文特征分类
const (
	HelloFeature FeatureType = iota
	DDFeature
	LSAFeature
	StateFeature
	StatFeature
)

// HelloFeatures Hello报文特征
type HelloFeatures struct {
	RouterID         net.IP
	HelloInterval    uint16
	DeadInterval     uint32
	Neighbors        []net.IP
	IntervalVariance float64 // Hello间隔方差
	NeighborChanges  int     // 邻居变化次数
	LastSeen         time.Time
}

// DDFeatures DD报文特征
type DDFeatures struct {
	RouterID    net.IP
	SequenceNum uint32
	LSACount    int // LSA数量
	MTU         uint16
	BitChanges  int // 标志位变化次数
}

// StatFeatures 统计特征
type StatFeatures struct {
	PacketSize       []int         // 报文大小分布
	PacketFrequency  float64       // 报文频率
	TypeDistribution map[uint8]int // 报文类型分布
}
